package info.motteke.kurumi;

import info.motteke.mixivoice4j.body.BodyVisitor;
import info.motteke.mixivoice4j.body.IconElement;
import info.motteke.mixivoice4j.body.LinkElement;
import info.motteke.mixivoice4j.body.StringElement;

public class SimpleStringVisitor implements BodyVisitor<String> {

    private final StringBuilder buf = new StringBuilder();

    @Override
    public String getValue() {
        return buf.toString();
    }

    @Override
    public void visit(StringElement stringElement) {
        buf.append(stringElement.getBody());
    }

    @Override
    public void visit(LinkElement linkElement) {
        buf.append(' ');
        buf.append(linkElement.getUrl());
        buf.append(' ');
    }

    @Override
    public void visit(IconElement iconElement) {
        buf.append(' ');
    }

}
